﻿using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PetShop.Web.Entities;

namespace PetShop.Web
{
    public partial class WebFormCheckOut : Page
    {
        protected CartInfo myCart;

        protected void Page_Load(object sender, EventArgs e)
        {
            myCart = (CartInfo) HttpContext.Current.Session["CART_KEY"];

            if (myCart == null)
            {
                HttpContext.Current.Server.Transfer("ShoppingCart.aspx");
            }

            link.Visible = myCart.Count > 0;
        }


        protected void CartPageChanged(object sender, DataGridPageChangedEventArgs e)
        {
            cart.CurrentPageIndex = e.NewPageIndex;
            cart.DataSource = myCart.Items;
            cart.DataBind();
        }
    }
}